import java.util.*;

import java.io.*;

class Read {
    StringTokenizer st = new StringTokenizer("");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

    String next() throws IOException {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());
        }
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
}
public class Test19 {
    public static Read in = new Read();
    public static PrintWriter out = new PrintWriter(new BufferedWriter(
            new OutputStreamWriter(System.out)));
    public static void main(String[] args) throws IOException {

        int t = in.nextInt();
        while (t-- != 0) {
            int n = in.nextInt();
            String[] s = new String[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
            }
            int left = 0, right = s.length - 1;
            boolean b = dfs(s, left, right);
            if (b) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
    public static boolean dfs(String[] s, int x, int y) {
        boolean b = false;
        if (x == y) {
            return true;
        }
        if ( x < y ) {
            for (int i = 0; i <= s[x].length() - 1; i++) {
                for (int j = 0; j <= s[y].length() - 1; j++) {
                    if (s[x].charAt(i) ==  s[y].charAt(j)) {
                        b = dfs(s, x + 1, y - 1);
                        if (b) {
                            break;
                        }else{
                            continue;
                        }
                    }
                }
                if (b) {
                    break;
                }
            }
        }
        return b;
    }








    public static int[] dx = {0, 1};
    public static int[] dy = {1, 0};

    public static void main02(String[] args) {
        int[][] grid={{1,3,1},{1,5,1},{4,2,1}};
        System.out.println(maxValue(grid));
    }

    public static int maxValue (int[][] grid) {
        int sum =dfs(grid,0,0);
        return sum;
    }
    public static int dfs(int[][] grid, int x, int y) {
        int m = grid.length, n = grid[0].length;
        if ( x == m - 1 && y == n - 1) {
            // 到达右下角
            return grid[m - 1][n - 1];
        } else {
            if (x < m && y < n) {
                return grid[x][y]+Math.max(dfs(grid,x + dx[0],y + dy[0]), dfs(grid,x + dx[1],y + dy[1]));
            } else if (x == m-1 && y < n ) {
                return grid[x][y]+dfs(grid,x + dx[0],y + dy[0]);
            } else if( x<m && y == m-1){
                return grid[x][y]+dfs(grid,x + dx[1],y + dy[1]);
            }else{
                return 0;
            }
        }


    }

}
